home *** CD-ROM | disk | FTP | other *** search
/ Freelog 112 / FreelogNo112-NovembreDecembre2012.iso / Jeu / deadlyrace / deadlyrace_setup.exe / {app} / Data / Scripts / lock2.lua < prev    next >
Encoding:
Text File  |  2009-03-26  |  1.1 KB  |  65 lines

  1. local script = globalObject;
  2.  
  3. local interface;
  4. local commandMap = {};
  5.  
  6. local x = 0;
  7. local y = 0;
  8. local z = 0;
  9. local aim = nil;
  10.  
  11.  
  12. local function ExecuteCommands()
  13.     while(SetNextCommand(script))
  14.     do
  15.         local command = GetCurrentCommand(script);
  16.         if (commandMap[command])
  17.         then
  18.             commandMap[command]();
  19.         end
  20.     end
  21. end
  22.  
  23.  
  24.  
  25. local function AddObject()
  26.     local obj = GetCurrentParams(script);
  27.     interface = StringToPointer(obj);
  28. --    AddRef(interface);
  29. end
  30.  
  31. local function DeleteObject()
  32.     Release(interface);
  33.     StopScript(script);
  34.     interface = nil;
  35. end
  36.  
  37. local function ReleaseAll()
  38.     Release(interface);
  39.     interface = nil;
  40. end
  41.  
  42. local function UpdateGameInterface1()
  43.     UpdateGameInterface(interface);
  44. end
  45.  
  46. local function SetText()
  47.     local text = GetCurrentParams(script);
  48.     SetTextString(interface, "text", text);
  49. end
  50.  
  51. commandMap["set_text"] = SetText;
  52. commandMap["release_all"] = ReleaseAll;
  53. commandMap["add_object"] = AddObject;
  54. commandMap["delete_object"] = DeleteObject;commandMap["video_end"] = VideoEnd;
  55.  
  56.  
  57.  
  58. while(true)
  59. do
  60.     ExecuteCommands();
  61.     UpdateInterface(interface);
  62.  
  63.     Update();
  64. end
  65.